#pragma once
#include "StdAfx.h"
#include "EntityControl.h"
#include "Controller.h"
#include "DamageAction.h"
#include "PSysAction.h"


//class EntityControl;

class ContactReport : public NxUserContactReport
{	

	Ogre::SceneManager * mSceneMgr;

	


	void onContactNotify(NxContactPair& pair, NxU32 events)	
	{		
		EntityControl* Actor1UserData = static_cast<EntityControl*>( pair.actors[0]->userData );	
		EntityControl* Actor2UserData = static_cast<EntityControl*>( pair.actors[1]->userData );


		if(pair.actors[0]->getGroup()==2 && pair.actors[1]->getGroup()==3)
		{
			Trigger *damage = new Trigger(); 
			damage->addAction(new DamageAction(20));
			damage->addAction(new PSysAction(mSceneMgr,"paff"));
			Actor1UserData->AddTrigger(damage);
			pair.actors[1]->setGroup(0);
		}

		if(pair.actors[0]->getGroup()==3 && pair.actors[1]->getGroup()==2)
		{
			Trigger *damage = new Trigger(); 
			damage->addAction(new DamageAction(20));
			damage->addAction(new PSysAction(mSceneMgr,"paff"));
			Actor2UserData->AddTrigger(damage);
			pair.actors[0]->setGroup(0);
		}
	// if actor1userdata.entitytype == car || actor2userdata.entitytype == car		
	//		play car smash sound, spawn particle emitter etc	
	}


public:
	void setSceneManager(Ogre::SceneManager *scm)
	{
		mSceneMgr = scm;
	}
}contactReport;